home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility2 / wine02bx.zip / LISP / PACKAGES / HEXL.ELC < prev    next >
Text File  |  1993-03-28  |  16KB  |  203 lines

  1. ;;; compiled by jwz@thalidomide on Thu Jul  2 16:35:56 1992
  2. ;;; from file /u/jwz/emacs19/lisp/packages/hexl.el
  3. ;;; emacs version 19.2.1 Lucid.
  4. ;;; bytecomp version 2.07; 17-jun-92.
  5. ;;; optimization is on.
  6. ;;; this file uses opcodes which do not exist in Emacs18.
  7.  
  8. (if (and (boundp 'emacs-version)
  9.      (or (and (boundp 'epoch::version) epoch::version)
  10.          (string-lessp emacs-version "19")))
  11.     (error "This file was compiled for Emacs19."))
  12.  
  13. (defvar hexl-program "hexl" "\
  14. The program that will hexlify and de-hexlify its stdin.  hexl-program
  15. will always be concated with hexl-options and " -de " when dehexlfying a\nbuffer.")
  16. (defvar hexl-iso "" "\
  17. If your emacs can handle ISO characters, this should be set to
  18. \"-iso\" otherwise it should be \"\".")
  19. (defvar hexl-options (format "-hex %s" hexl-iso) "\
  20. Options to hexl-program that suit your needs.")
  21. (defvar hexlify-command (format "%s %s" hexl-program hexl-options) "\
  22. The command to use to hexlify a buffer.  It is the concatination of
  23. `hexl-program' and `hexl-options'.")
  24. (defvar dehexlify-command (format "%s -de %s" hexl-program hexl-options) "\
  25. The command to use to unhexlify a buffer.  It is the concatination of
  26. `hexl-program', the option \"-de\", and `hexl-options'.")
  27. (defvar hexl-max-address 0 "\
  28. Maximum offset into hexl buffer.")
  29. (byte-code "└┴!¼é┬┬ç" [boundp hexl-mode-map nil] 2)
  30. (fset 'hexl-mode #[(&optional arg) "┴=½ä┬├!ç─ ê┼╞!ê╟ ╚    !ê┼╩!ê \n╠ ┼═!ê┴╬ `S╘=¼Æ½Ä╒ S╓Ñ╫_╪\\ë¬ÿ┌╒ S█ ê▄!ê▌!+ç" [major-mode hexl-mode error "You are already in hexl mode." kill-all-local-variables make-local-variable hexl-mode-old-local-map current-local-map use-local-map hexl-mode-map hexl-mode-old-mode-name mode-name "Hexl" hexl-mode-old-major-mode buffer-modified-p buffer-read-only original-point read-only modified arg 1 buffer-size 68 16 15 hexl-max-address nil hexlify-buffer set-buffer-modified-p hexl-goto-address] 3 "\
  31. \\<hexl-mode-map>
  32. A major mode for editting binary files in hex dump format.
  33.  
  34. This function automatically converts a buffer into the hexl format
  35. using the function `hexlify-buffer'.
  36.  
  37. Each line in the buffer has an `address' (displayed in hexadecimal)
  38. representing the offset into the file that the characters on this line
  39. are at and 16 characters from the file (displayed as hexadecimal
  40. values grouped every 16 bits) and as their ASCII values.
  41.  
  42. If any of the characters (displayed as ASCII characters) are
  43. unprintable (control or meta characters) they will be replaced as
  44. periods.
  45.  
  46. If hexl-mode is invoked with an argument the buffer is assumed to be
  47. in hexl-format.
  48.  
  49. A sample format:
  50.  
  51.   HEX ADDR: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f     ASCII-TEXT
  52.   --------  ---- ---- ---- ---- ---- ---- ---- ----  ----------------
  53.   00000000: 5468 6973 2069 7320 6865 786c 2d6d 6f64  This is hexl-mod
  54.   00000010: 652e 2020 4561 6368 206c 696e 6520 7265  e.  Each line re
  55.   00000020: 7072 6573 656e 7473 2031 3620 6279 7465  presents 16 byte
  56.   00000030: 7320 6173 2068 6578 6164 6563 696d 616c  s as hexadecimal
  57.   00000040: 2041 5343 4949 0a61 6e64 2070 7269 6e74   ASCII.and print
  58.   00000050: 6162 6c65 2041 5343 4949 2063 6861 7261  able ASCII chara
  59.   00000060: 6374 6572 732e 2020 416e 7920 636f 6e74  cters.  Any cont
  60.   00000070: 726f 6c20 6f72 206e 6f6e 2d41 5343 4949  rol or non-ASCII
  61.   00000080: 2063 6861 7261 6374 6572 730a 6172 6520   characters.are 
  62.   00000090: 6469 7370 6c61 7965 6420 6173 2070 6572  displayed as per
  63.   000000a0: 696f 6473 2069 6e20 7468 6520 7072 696e  iods in the prin
  64.   000000b0: 7461 626c 6520 6368 6172 6163 7465 7220  table character 
  65.   000000c0: 7265 6769 6f6e 2e0a                      region..
  66.  
  67. Movement is as simple as movement in a normal emacs text buffer.  Most
  68. cursor movement bindings are the same (ie. Use \\[hexl-backward-char], \\[hexl-forward-char], \\[hexl-next-line], and \\[hexl-previous-line]
  69. to move the cursor left, right, down, and up).
  70.  
  71. Advanced cursor movement commands (ala \\[hexl-beginning-of-line], \\[hexl-end-of-line], \\[hexl-beginning-of-buffer], and \\[hexl-end-of-buffer]) are
  72. also supported.
  73.  
  74. There are several ways to change text in hexl mode:
  75.  
  76. ASCII characters (character between space (0x20) and tilde (0x7E)) are
  77. bound to self-insert so you can simply type the character and it will
  78. insert itself (actually overstrike) into the buffer.
  79.  
  80. \\[hexl-quoted-insert] followed by another keystroke allows you to insert the key even if
  81. it isn't bound to self-insert.  An octal number can be supplied in place
  82. of another key to insert the octal number's ASCII representation.
  83.  
  84. \\[hexl-insert-hex-char] will insert a given hexadecimal value (if it is between 0 and 0xFF)
  85. into the buffer at the current point.
  86.  
  87. \\[hexl-insert-octal-char] will insert a given octal value (if it is between 0 and 0377)
  88. into the buffer at the current point.
  89.  
  90. \\[hexl-insert-decimal-char] will insert a given decimal value (if it is between 0 and 255)
  91. into the buffer at the current point.
  92.  
  93. \\[hexl-save-buffer] will save the buffer in is binary format.
  94.  
  95. \\[hexl-mode-exit] will exit hexl-mode.
  96.  
  97. Note: \\[write-file] will write the file out in HEXL FORMAT.
  98.  
  99. You can use \\[hexl-find-file] to visit a file in hexl-mode.
  100.  
  101. \\[describe-bindings] for advanced commands." "p"])
  102. (fset 'hexl-save-buffer #[nil "└┴ ½╔è┬├!─ ┼ ed╞    \n ë qê═     #ê qê╬ ê╧ ê┴ ed|ê═     #ê╨ !ê.¬à╤╥!ê╞!ç" [set-buffer-modified-p buffer-modified-p generate-new-buffer " hexl" buffer-name buffer-file-name nil modified end start file-name name buf insert-buffer-substring dehexlify-buffer save-buffer kill-buffer message "(No changes need to be saved)"] 8 "\
  103. Save a hexl format buffer as binary in visited file if modified." nil])
  104. (fset 'hexl-find-file #[(filename) "└    !ê\n├=?¡é├ ç" [find-file filename major-mode hexl-mode] 2 "\
  105. Edit file FILENAME in hexl-mode.
  106.  
  107. Switch to a buffer visiting file FILENAME, creating one in none exists." "fFilename: "])
  108. (fset 'hexl-mode-exit #[(&optional arg) "┴=¼â¼£┬  ─ T╚╔ ê╩!êbê+  ═!ê╤p!ç" [arg 1 buffer-modified-p buffer-read-only hexl-current-address original-point read-only modified nil dehexlify-buffer set-buffer-modified-p hexl-mode-old-mode-name mode-name use-local-map hexl-mode-old-local-map hexl-mode-old-major-mode major-mode switch-to-buffer] 3 "\
  109. Exit hexl-mode returning to previous mode.
  110. With arg, don't unhexlify buffer." "p"])
  111. (fset 'hexl-current-address #[nil "`└ª┴Z┬`└Ñ┼_ ë╞ÑZ╟Ñ\\ë*ç" [68 11 0 hexl-address current-column 16 5 2] 5 "\
  112. Return current hexl-address." nil])
  113. (fset 'hexl-address-to-marker #[(address) "┴Ñ┬_┴ª├_─Ñ┼\\\\ç" [address 16 68 5 2 11] 3 "\
  114. Return marker for ADDRESS." "nAddress: "])
  115. (fset 'hexl-goto-address #[(address) "┴W¼à\nV½ä├─!ê┼!bç" [address 0 hexl-max-address error "Out of hexl region." hexl-address-to-marker] 2 "\
  116. Goto hexl-mode (decimal) address ADDRESS.
  117.  
  118. Signal error if ADDRESS out of range." "nAddress: "])
  119. (fset 'hexl-goto-hex-address #[(hex-address) "└┴\n!!ç" [hexl-goto-address hexl-hex-string-to-integer hex-address] 3 "\
  120. Goto hexl-mode address (hex string) HEX-ADDRESS.
  121.  
  122. Signal error if HEX-ADDRESS is out of range." "sHex Address: "])
  123. (fset 'hexl-hex-string-to-integer #[(hex-string) "└\n├ܼƠ   ─_┼╞\n!!\\\n╟╚Oë¬j    )ç" [0 hex-num hex-string "" 16 hexl-hex-char-to-integer string-to-char 1 nil] 5 "\
  124. Return decimal integer for HEX-STRING." "sHex number: "])
  125. (fset 'hexl-octal-string-to-integer #[(octal-string) "└\n├ܼƠ   ─_┼╞\n!!\\\n╟╚Oë¬j    )ç" [0 oct-num octal-string "" 8 hexl-oct-char-to-integer string-to-char 1 nil] 5 "\
  126. Return decimal integer for OCTAL-STRING." "sOctal number: "])
  127. (fset 'hexl-backward-char #[(arg) "└┴ \nZ!ç" [hexl-goto-address hexl-current-address arg] 3 "\
  128. Move to left ARG bytes (right if ARG negative) in hexl-mode." "p"])
  129. (fset 'hexl-forward-char #[(arg) "└┴ \n\\!ç" [hexl-goto-address hexl-current-address arg] 3 "\
  130. Move right ARG bytes (left if ARG negative) in hexl-mode." "p"])
  131. (fset 'hexl-backward-short #[(arg) "└┴  ─W½╒ [ë─V½╖\n┼\n╞\"ܼû\nV½ë╚╔!ê¬Ü┼\n╞\"¬ô\nV½ë╚╔!ê¬ä\n╩\\ Së¬E\nV½ë╚╔!ê¬░┼\n╞\"¬⌐ ─V½ñ\n╦\n╠\"ܼç╦\n╠\"¬Å\n─ܼå\n╩Z¬ä╚═!ê Së¬X\n)!ç" [hexl-goto-address hexl-current-address address arg 0 logior 3 hexl-max-address message "End of buffer." 4 logand -4 "Beginning of buffer."] 6 "\
  132. Move to left ARG shorts (right if ARG negative) in hexl-mode." "p"])
  133. (fset 'hexl-forward-short #[(arg) "└    [!ç" [hexl-backward-short arg] 2 "\
  134. Move right ARG shorts (left if ARG negative) in hexl-mode." "p"])
  135. (fset 'hexl-backward-word #[(arg) "└┴  ─W½╒ [ë─V½╖\n┼\n╞\"ܼû\nV½ë╚╔!ê¬Ü┼\n╞\"¬ô\nV½ë╚╔!ê¬ä\n╩\\ Së¬E\nV½ë╚╔!ê¬░┼\n╞\"¬⌐ ─V½ñ\n╦\n╠\"ܼç╦\n╠\"¬Å\n─ܼå\n╩Z¬ä╚═!ê Së¬X\n)!ç" [hexl-goto-address hexl-current-address address arg 0 logior 7 hexl-max-address message "End of buffer." 8 logand -8 "Beginning of buffer."] 6 "\
  136. Move to left ARG words (right if ARG negative) in hexl-mode." "p"])
  137. (fset 'hexl-forward-word #[(arg) "└    [!ç" [hexl-backward-word arg] 2 "\
  138. Move right ARG words (left if ARG negative) in hexl-mode." "p"])
  139. (fset 'hexl-previous-line #[(arg) "└    [!ç" [hexl-next-line arg] 2 "\
  140. Move vertically up ARG lines [16 bytes] (down if ARG negative) in
  141. hexl-mode.
  142.  
  143. If there is byte at the target address move to the last byte in that
  144. line." "p"])
  145. (fset 'hexl-next-line #[(arg) "└┴ \n├_\\\n┼W½É ┼W½ï╞╟!ê┴ ├ª¬¬ V½Å├ª ├ªW½à¬ò V½Å╞╟!ê╔╩\"┴ ├ª\\ )!ç" [hexl-goto-address hexl-current-address arg 16 address 0 message "Out of hexl region." hexl-max-address logand -16] 4 "\
  146. Move vertically down ARG lines [16 bytes] (up if ARG negative) in
  147. hexl-mode.
  148.  
  149. If there is no byte at the target address move to the last byte in that
  150. line." "p"])
  151. (fset 'hexl-beginning-of-buffer #[(arg) "└`!ê┴\nS!ç" [push-mark hexl-goto-address arg] 2 "\
  152. Move to the beginning of the hexl buffer; leave hexl-mark at previous
  153. posistion.
  154.  
  155. With arg N, put point N bytes of the way from the true beginning." "p"])
  156. (fset 'hexl-end-of-buffer #[(arg) "└`!ê┴\n SZ!ç" [push-mark hexl-goto-address hexl-max-address arg] 3 "\
  157. Goto hexl-max-address minus ARG." "p"])
  158. (fset 'hexl-beginning-of-line #[nil "`└Ñ└_┴\\bç" [68 11] 2 "\
  159. Goto beginning of line in hexl mode." nil])
  160. (fset 'hexl-end-of-line #[nil "└┴┬ ├\"ëV½é )!ç" [hexl-goto-address logior hexl-current-address 15 address hexl-max-address] 5 "\
  161. Goto end of line in hexl mode." nil])
  162. (fset 'hexl-scroll-down #[(arg) "¼å┴ S¬ä┬!├[!ç" [arg window-height prefix-numeric-value hexl-scroll-up] 2 "\
  163. Scroll hexl buffer window upward ARG lines; or near full window if no ARG." "P"])
  164. (fset 'hexl-scroll-up #[(arg) "¼å┴ S¬ä┬!├_─ \\V¼ê\\╚W½à╔╩!¬è╦\\!ê╠╚!*ç" [arg window-height prefix-numeric-value 16 hexl-current-address address movement hexl-max-address 0 message "Out of hexl region." hexl-goto-address recenter] 3 "\
  165. Scroll hexl buffer window upward ARG lines; or near full window if no ARG." "P"])
  166. (fset 'hexl-beginning-of-1k-page #[nil "└┴┬ ├\"!ç" [hexl-goto-address logand hexl-current-address -1024] 4 "\
  167. Goto to beginning of 1k boundry." nil])
  168. (fset 'hexl-end-of-1k-page #[nil "└┴┬ ├\"ëV½é )!ç" [hexl-goto-address logior hexl-current-address 1023 address hexl-max-address] 5 "\
  169. Goto to end of 1k boundry." nil])
  170. (fset 'hexl-beginning-of-512b-page #[nil "└┴┬ ├\"!ç" [hexl-goto-address logand hexl-current-address -512] 4 "\
  171. Goto to beginning of 512 byte boundry." nil])
  172. (fset 'hexl-end-of-512b-page #[nil "└┴┬ ├\"ëV½é )!ç" [hexl-goto-address logior hexl-current-address 511 address hexl-max-address] 5 "\
  173. Goto to end of 512 byte boundry." nil])
  174. (fset 'hexl-quoted-insert #[(arg) "└┴ \n\"ç" [hexl-insert-char read-quoted-char arg] 3 "\
  175. Read next input character and insert it.
  176. Useful for inserting control characters.
  177. You may also type up to 3 octal digits, to insert a character with that code" "p"])
  178. (fset 'hexlify-buffer #[nil "└ed    ┬$ç" [shell-command-on-region hexlify-command t] 5 "\
  179. Convert a binary buffer to hexl format" nil])
  180. (fset 'dehexlify-buffer #[nil "└ed    ┬$ç" [shell-command-on-region dehexlify-command t] 5 "\
  181. Convert a hexl format buffer to binary." nil])
  182. (fset 'hexl-char-after-point #[nil "`f`Tf┬    \"ç" [lh rh hexl-htoi] 3 "\
  183. Return char for ASCII hex digits at point."])
  184. (fset 'hexl-htoi #[(lh rh) "└    !┬_└ !\\ç" [hexl-hex-char-to-integer lh 16 rh] 3 "\
  185. Hex (char) LH (char) RH to integer."])
  186. (fset 'hexl-hex-char-to-integer #[(character) "┴Y½ë┬X½ä┴Zç├─\"ë╞Y½è╟X½à╚Z¬å╔╩╦\"!)ç" [character 48 57 logior 32 ch 97 102 87 error format "Invalid hex digit `%c'."] 5 "\
  187. Take a char and return its value as if it was a hex digit."])
  188. (fset 'hexl-oct-char-to-integer #[(character) "┴Y½ë┬X½ä┴Zç├─┼\"!ç" [character 48 55 error format "Invalid octal digit `%c'."] 4 "\
  189. Take a char and return its value as if it was a octal digit."])
  190. (fset 'hexl-printable-character #[(ch) "└┴\n½ò ─W¼è ┼Y½ê ╞W½â╟¬æ ¬Ä ─W¼à ┼Y½â╟¬ü \"ç" [format "%c" hexl-iso ch 32 127 160 46] 4 "\
  191. Return a displayable string for character CH."])
  192. (fset 'hexl-self-insert-command #[(arg) "└    \n\"ç" [hexl-insert-char last-command-char arg] 3 "\
  193. Insert this character." "p"])
  194. (fset 'hexl-insert-char #[(ch num) "└ \n├V¡╣─┼!ê╞╟\"cê    ╔Ñ╩_    ╔ª╦\\\\bê─╠!ê═!cê    =½å╧    !ê¬à╧    T!ê\nSë¬C)ç" [hexl-current-address address num 0 delete-char 2 format "%02x" ch 16 68 52 1 hexl-printable-character hexl-max-address hexl-goto-address] 4 "\
  195. Insert a character in a hexl buffer."])
  196. (fset 'hexl-insert-hex-char #[(arg) "└┴┬!!ë─V¼à ┼W½à╞╟!¬à╚     \")ç" [hexl-hex-string-to-integer read-string "Hex number: " num 255 0 error "Hex number out of range." hexl-insert-char arg] 4 "\
  197. Insert a ASCII char ARG times at point for a given hexadecimal number." "p"])
  198. (fset 'hexl-insert-decimal-char #[(arg) "└┴┬!!ë─V¼à ┼W½à╞╟!¬à╚     \")ç" [string-to-int read-string "Decimal Number: " num 255 0 error "Decimal number out of range." hexl-insert-char arg] 4 "\
  199. Insert a ASCII char ARG times at point for a given decimal number." "p"])
  200. (fset 'hexl-insert-octal-char #[(arg) "└┴┬!!ë─V¼à ┼W½à╞╟!¬à╚     \")ç" [hexl-octal-string-to-integer read-string "Octal Number: " num 255 0 error "Decimal number out of range." hexl-insert-char arg] 4 "\
  201. Insert a ASCII char ARG times at point for a given octal number." "p"])
  202. (byte-code "ä5┴ ┬├─#ê┬┼╞#ê┬╟╚#ê┬╔╩#ê┬╦╠#ê═╬!╧=¼å┬╬╚#ê┬╨╤#ê┬╥╤#ê┬╙╚#ê┬╘╤#ê┬╒╓#ê┬╫╚#ê┬╪┘#ê┬┌█#ê┬▄╚#ê┬▌▐#ê┬▀╚#ê┬α╚#êß\"ßπW½Æ┬Σσ\"\"╤#ê\"Të\"¬j)┬µτ#ê┬ΦΘ#ê┬Ω╚#ê┬δ∞#ê┬φε#ê┬∩≡#ê┬±╚#ê┬≥╚#ê┬≤╚#ê┬⌠╚#ê┬⌡╚#ê┬÷╚#ê┬≈╚#ê┬°╚#ê┬∙·#ê┬√╚#ê┬ⁿ╚#ê┬²╚#ê┬■╚#ê┬ ╚#ê┬ü@╚#ê┬üA╚#ê┬üBüC#ê┬üD╚#ê┬üEüF#ê┬üGüH#ê┬üI╚#ê┬üJ╚#ê┬üKüL#ê┬üMüN#ê┬üOüP#ê┬üQ╚#ê┬üR╚#ê┬üSüT#ê┬üU╚#ê┬üV╚#ê┬üW╚#ê┬üX╚#ê┬üY╚#ê┬üZ╚#ê┬ü[╚#ê┬ü\\╚#ê┬ü]╚#ê┬ü^╚#ê┬ü_╚#ê┬ü`üa#ê┬üb╚#ê┬üc╚#ê┬üdüe#ê┬üfüg#ê┬ühüi#ê┬üj╚#ê┬ükül#ê┬üm╚#ê┴ç" [hexl-mode-map make-sparse-keymap define-key "" hexl-beginning-of-line "" hexl-backward-char "" undefined "" hexl-end-of-line "" hexl-forward-char key-binding "" help-command "    " hexl-self-insert-command "\n" " " "" "" hexl-next-line "" "" hexl-previous-line "" hexl-quoted-insert "" "" hexl-scroll-up "" "" 32 ch 127 format "%c" "" hexl-beginning-of-512b-page "" hexl-backward-short "" "" hexl-insert-decimal-char "" hexl-end-of-512b-page "" hexl-forward-short "" "" "    " "\n" " " " " "" "" "" hexl-insert-octal-char "" "" "" "" "" "" "" "" hexl-insert-hex-char "" "a" hexl-beginning-of-1k-page "b" hexl-backward-word "c" "d" "e" hexl-end-of-1k-page "f" hexl-forward-word "g" hexl-goto-hex-address "h" "i" "j" hexl-goto-address "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" hexl-scroll-down "y" "z" "<" hexl-beginning-of-buffer ">" hexl-end-of-buffer "" hexl-mode-exit "" "" hexl-save-buffer ""] 6)
  203.